/*
* Copyright (C) 2012-2013, <Aeihu.z, aeihu.z@gmail.com>.
*
* Game Scenario Maker is a free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2(GPLv2) as published by the Free Software Foundation.
*/

//#include "CGalleryBox.h"
//#include "SDL_rotozoom.h"
//
//CGalleryBox::CGalleryBox()
//{
//    Space = 10;
//    Pages =
//    PageNo = 0;
//    Surf_Def = NULL;
//}
//
//int CGalleryBox::HowManyColOrRow(int val)
//{
//    int result = 0;
//    int w = 0;
//    while (true)
//    {
//        w += Surf_Def->w;
//        if (val > w)
//            result++;
//        else
//            break;
//
//        w += Space;
//        if (val <= w)
//            break;
//    }
//
//    return result;
//}
//
//bool CGalleryBox::Subclass_Init()
//{
//    OffsetOfBox.x = CCommon::common.GALLERYBOX_LOCATION_X;
//    OffsetOfBox.y = CCommon::common.GALLERYBOX_LOCATION_Y;
//    OffsetOfInfo.x = CCommon::common.GALLERYBOX_INFO_OFFSET_X;
//    OffsetOfInfo.y = CCommon::common.GALLERYBOX_INFO_OFFSET_Y;
//
//    Surf_Def = CSurface::OnCreate(CCommon::common.GALLERYBOX_IMAGE_WIDTH, CCommon::common.GALLERYBOX_IMAGE_HEIGHT);
//    if (Surf_Def == NULL)
//        return false;
//
//    MaxColnum = HowManyColOrRow(OffsetOfInfo.w);
//    MaxRownum = HowManyColOrRow(OffsetOfInfo.h);
//    //MaxColnum = CBox::Surf_Show->w /
//    return true;
//}
//
//void CGalleryBox::Subclass_Cleanup()
//{
//    if (Surf_Def != NULL)  
//        SDL_FreeSurface(Surf_Def);
//    Surf_Def = NULL;
//}
//
//int CGalleryBox::AddGallery(string path)
//{
//    SDL_Surface* Surf_Temp = CSurface::OnLoad(path.c_str());
//    SDL_Surface* Surf_Img = NULL;
//    
//    if (Surf_Temp != NULL)
//    {
//        double zoom_x = ((double)Surf_Def->w) / ((double)Surf_Temp->w);
//        double zoom_y = ((double)Surf_Def->h) / ((double)Surf_Temp->h);
//
//        Surf_Img = zoomSurface(Surf_Temp, zoom_x, zoom_y, SMOOTHING_ON);  
//        SDL_FreeSurface(Surf_Temp);
//    }
//
//    if (Surf_Img == NULL)
//        return 0;
//
//    CG_List.push_back(new CGallery(path, Surf_Img));
//    return 1;
//}
//
//void CGalleryBox::OnLoop()
//{
//    CBox::OnLoop();
//}
//
//void CGalleryBox::OnRender(SDL_Surface* Surf_Dest)
//{
//    for (int i = 0; i < MaxRownum; i++)
//        for (int j = 0; j < MaxColnum; j++){
//            if (i*MaxColnum + j >= CG_List.size())
//                return;
//
//            CSurface::OnDraw(Surf_Show, CG_List[i*MaxColnum + j]->Surf_Image,
//                OffsetOfInfo.x + j * (Surf_Def->w + Space),
//                OffsetOfInfo.y + i * (Surf_Def->h + Space));
//        }
//}
